/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package zombiedefense.map;

import zombiedefense.sprites.Player;

/**
 *
 * @author &{user}
 */
public class Camera {
    public double x,y,dx,dy;
    private Player player;
    
    public Camera(double x,double y,Player p){
	this.x = x;
	this.y = y;
	dx = 0;
	dy = 0;
	this.player = p;
    }
    
    /**
     * Centers the camera over the player.
     */
    public void center(int width,int height){
	x = player.getX() - TileMap.pixelsToGridUnits(width/2);
	y = player.getY() - TileMap.pixelsToGridUnits(height/2);
    }
    
    public void update(long elapsedTime){
	x += dx * elapsedTime;
	y += dy * elapsedTime;
    }
    
}
